package org.blade.personal.framework.orm.loader.concre;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import org.blade.personal.framework.orm.loader.Setter;
import org.blade.personal.framework.orm.loader.TestSetter;

/**
 * 
 * @author ZGF
 *
 */
public class SimpleSetter implements Setter {

	@Override
	public void set(Object obj, Method method, Object value) {
		try {
			method.invoke(obj, value);
		} catch (IllegalArgumentException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch (InvocationTargetException e) {
			e.printStackTrace();
		}
	}
	
	public static void main(String[] args) {
		
		TestSetter ts = new TestSetter();
		
		TestSetter ts1 = new TestSetter();

		Setter setter = new SimpleSetter();
		
		
		try {
			Method method = ts.getClass().getMethod("setSt", String.class);
			setter.set(ts1, method, "343");
			System.out.println(ts1.getSt());
			
		} catch (SecurityException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (NoSuchMethodException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	
	}

}
